package com.bj58.ecdata.mailreport.service.impl;

import java.util.List;

import com.bj58.ecdata.mailreport.db.CommonDao;
import com.bj58.ecdata.mailreport.db.DBConfig;
import com.bj58.ecdata.mailreport.model.IETable;
import com.bj58.ecdata.mailreport.service.AbstractBaseService;

public class IETableService extends AbstractBaseService<IETable> {
	private CommonDao comDao = new CommonDao();
	
	public List<IETable> getListByCon(String condition) throws Exception {
		String sql = "select * from ie_table where " + condition ;
		return comDao.getAllColsByVo(sql, IETable.class, DBConfig.db_manage.getIntType());
	}

	public IETable getById(int id) throws Exception {
		String sql = "select * from ie_table where id = " + id;
		return comDao.getAllColsByVo(sql, IETable.class, DBConfig.db_manage.getIntType()).get(0);
	}

	public boolean updateVo(IETable vo) throws Exception {
		int res =  comDao.updateByVo("ie_table", "id=" + vo.getId(), IETable.class, vo, DBConfig.db_manage.getIntType());
		return res==0?false:true;
	}

	public boolean saveList(List<IETable> contentList) throws Exception {
		return comDao.insertVoList("ie_table", IETable.class, contentList, DBConfig.db_manage.getIntType());
	}

	public boolean deleteByCons(String condition) throws Exception {
		return comDao.deleteData("ie_table", condition, DBConfig.db_manage.getIntType());
	}


}
